package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.gitee;

import com.glsc.ngateway.common.base.domain.mysql.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;


/**
 * @author xuchang
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Where(clause = "deleted = 0")
@SQLDelete(sql = "update t_gw_gitee_sync_log set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@SQLDeleteAll(sql = "update t_gw_gitee_sync_log set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@Table(name = "t_gw_gitee_sync_log"
//        , indexes = {@Index(name = "IDX_PRO_TASK", columnList = "process_def_key, task_def_key, config_type, deleted")}
)
public class GiteeSyncLog extends BaseEntity {

    private static final long serialVersionUID = -4881971079582370963L;

    @Column(name = "process_def_key", columnDefinition = "varchar(128) not null comment '流程定义key'")
    private String processDefKey;

    @Column(name = "task_def_key", columnDefinition = "varchar(128) comment '节点定义key'")
    private String taskDefKey;

    @Column(name = "process_id", columnDefinition = "varchar(128) not null comment '配置类别'")
    private String processId;

    @Column(name = "task_id", columnDefinition = "varchar(128)")
    private String taskId;

    @Column(name = "status", columnDefinition = "varchar(32) not null")
    private String status;

    @Column(name = "gitee_issue_id", columnDefinition = "varchar(128)")
    private String giteeIssueId;

    @Column(name = "gitee_issue_type", columnDefinition = "varchar(128)")
    private String giteeIssueType;

}
